//javascript 语句实例
/* == if 标准语句
 ---------------------------------------------------------------------------------------------------- = 2012-10-29 */
function aa01()
{
	var time = 5;
	if (time < 5)
		;
	{
		document.write("现在还没有到五点点 还可以继续睡下!");
	}
}
/* == if    else 标准语句
 ---------------------------------------------------------------------------------------------------- = 2012-10-29 */
function aa02()
{
	var time = 7;
	if (time < 6)
	{
		document.write("现在还没有到六点 还可以继续睡下!");
	}
	else
	{
		document.write("现在时间超过六点, 赶快起床上班!");
	}
}
/* == if    esle if    else 标准语句
 ---------------------------------------------------------------------------------------------------- = 2012-10-29 */
function aa03()
{
	var time = 12;
	if (time < 7)
	{
		document.write("现在时间小于七点!");
	}
	else if (time < 9)
	{
		document.write("现在时间小于九点!");
	}
	else
	{
		document.write("现在时间不重要时段!");
	}
}
/* == if    else if    esle 多级镶套
 ---------------------------------------------------------------------------------------------------- = 2012-10-29 */
function aa04()
{
	var sex = "man";
	var age = 23;
	if (sex == "girl")
	{
		if (age <= 18)
		{
			document.write("男性 未成年");
		}
		else
		{
			document.write("男性 已成年");
		}
	}
	else
	{
		if (age <= 18)
		{
			document.write("女性 未成年");
		}
		else
		{
			document.write("女性 已成年");
		}
	}
}
/* == if    else if    else 课外练习一
 ---------------------------------------------------------------------------------------------------- = 2012-10-29 */
function aa05()
{
	var time = 25;
	if (time >= 8 && time < 12)
	{
		document.write("08-12点 是我早班时间");
	}
	else if (time >= 12 && time < 14)
	{
		document.write("12-14点 是我午休时间");
	}
	else
	{
		if (time >= 18 && time <= 24)
		{
			document.write("18-24点 是我泡妞时间");
		}
		else
		{
			if (time < 25)
			{
				document.write("24-08点 是我睡觉时间");
			}
			else
			{
				document.write("你的时间在25点以上 ,你不是地球人");
			}
		}
	}
}
/* == switch
 ---------------------------------------------------------------------------------------------------- = 2012-10-30 */
function aa06()
{
	var time = 03;
	switch (time)
	{
	case 00:
		document.write("010");
		break;
	case 01:
		document.write("01");
		break;
	case 02:
		document.write("02");
		break;
	case 03:
		document.write("03");
		break;
	case 04:
		document.write("04");
		break;
	case 05:
		document.write("05");
		break;
	case 06:
		document.write("06");
		break;
	case 07:
		document.write("07");
		break;
	case 08:
		document.write("08");
		break;
	case 09:
		document.write("09");
		break;
	default:
		document.write("现在时间是XX点");
		break;
	}
}
/* == switch if  else
 ---------------------------------------------------------------------------------------------------- = 2012-10-30 */
function aa07()
{
	var sex = "man";
	var age = 17;
	switch (sex)
	{
	case "girl":
		if (age < 18)
		{
			document.write("男性 未成年");
		}
		else
		{
			document.write("男性 已成年");
		}
		break;
	default:
		if (age < 18)
		{
			document.write("女性 未成年");
		}
		else
		{
			document.write("女性 已成年");
		}
		break;
	}
}
/* == for
 ---------------------------------------------------------------------------------------------------- = 2012-10-30 */
function aa08()
{
	for (i = 12; i <= 24; i += 3)
	{
		document.write(i + "</br>");
	}
}
/* == whilewhile 语句

 while 语句是前测试循环。这意味着退出条件是在执行循环内部的代码之前计算的。因此，循环主体可能根本不被执行。
 ---------------------------------------------------------------------------------------------------- = 2012-10-31 */
function aa09()
{
	var time = 0;
	while (time <= 24)
	{
		time += 3;
		document.write(time + "</br>");
	}
};
/* == do while
 ---------------------------------------------------------------------------------------------------- = 2012-10-31 */
function aa10()
{
	var year = 2005;
	while (year > 2008)
	{
		document.write(year + "</br>");
		year++;
	}
	;
	do
	{
		document.write(year + "</br>");
		year++;
	}
	while (year > 2008)
}
/* == 函数的值返回
 ---------------------------------------------------------------------------------------------------- = 2012-10-31 */
function aa11()
{
	function kk(a, b)
	{
		return a * b;
	}
	var c = kk(3, 6);
	document.write(c);
}
/* == 函数引用返回
 ---------------------------------------------------------------------------------------------------- = 2012-10-31 */
function aa12()
{
	function kk()
	{
		var list = new Array("一号", "二号", "三号", "四号");
		return list;
	}
	var bb = kk();
	document.write(bb);
}
/* == 
---------------------------------------------------------------------------------------------------- = 2012-10-31 */
function aa13(message, love)
{
	if (arguments[0] == "message")
	{
		return;
	}
	document.write(arguments[0]);
}
/* == 
 ---------------------------------------------------------------------------------------------------- = 2012-11-1 */
function aa14()
{
	var aa = new Array("一号", "二号", "三号", "四号");
	for (x in aa)
	{
		document.write(aa[x] + " ");
	}
}
/* == 
 ---------------------------------------------------------------------------------------------------- = 2012-11-1 */
function aa15()
{
	var BLUE = "#111111", RED = "#222222", GREEN = "#555555", OTHER = "#000000";
	var sColor = RED;
	switch (sColor)
	{
	case BLUE:
		document.write(BLUE);
		break;
	case RED:
		document.write(RED);
		break;
	case GREEN:
		document.write(GREEN);
		break;
	default:
		document.write(OTHER);
	}
}
/* == 显示调用函数参数的个数
 ---------------------------------------------------------------------------------------------------- = 2012-11-1 */
function aa16()
{
	function aa(cc, dd)
	{
		if (arguments.length == 1)
		{
			document.write(arguments[0] + " 函数只有一个参数" + arguments.length);
		}
		else if (arguments.length == 2)
		{
			document.write(arguments[0] + " " + arguments[1] + " 函数有两个参数" + arguments.length);
		}
	}
	aa(10); //输出 "15"
	document.write("</br>");
	aa(20, 40); //输出 "60"
	document.write("</br>");
}
/* == 
 ---------------------------------------------------------------------------------------------------- = 2012-11-1 */
function aa17()
{
	function aa(aa, bb)
	{
		document.write(arguments.length);
		document.write("</br>");
	}
	aa("你好", "我好");
}
/* == 
 ---------------------------------------------------------------------------------------------------- = 2012-11-2 */
